import { getResourcesPages } from "@/api/resources"

//查询条件
export const queryCondition = reactive({
    name: '',   
    url: '',
    categoryId: '',
    current: 1,
    size: 5,
})
//查询结果
export const queriedResult = ref({
    current: 1,
    records: [],
    total: 0,
    size: 0,
})
//查询方法
export const queryResources = async () => {

     const {data} = await getResourcesPages(queryCondition)
     if ( data.code === '000000' ) {
        queriedResult.value = data.data
     } else {
        ElMessage.error('获取资源失败')
        throw new Error('获取资源失败')
     }
}